<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css/login.css" />

   <link type="text/css" rel="stylesheet" href="css/message.css" />
  <%-- <script type="text/javascript" src="js/message.min.js"></script>--%>

<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
   <script type="text/javascript" src="js/login.js"></script>
   <script type="text/javascript">
      $.extend({message:function(j){var e={message:" 操作成功",time:"2000",type:"success",showClose:false,autoClose:true,onClose:function(){}};if(typeof j==="string"){e.message=j}if(typeof j==="object"){e=$.extend({},e,j)}var c=e.showClose?'<a class="c-message--close">×</a>':"";var i='<div class="c-message messageFadeInDown"><div class="c-message--main"><i class=" c-message--icon c-message--'+e.type+'"></i>'+c+'<div class="c-message--tip">'+e.message+"</div></div></div>";var h=this;var f=$("body");var g=$(i);var d;var a,b;a=function(){g.addClass("messageFadeOutUp");g.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){b()})};b=function(){g.remove();e.onClose(e);clearTimeout(d)};$(".c-message").remove();f.append(g);g.css({"margin-left":"-"+g.width()/2+"px"});g.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){g.removeClass("messageFadeInDown")});f.on("click",".c-message--close",function(k){a()});if(e.autoClose){d=setTimeout(function(){a()},e.time)}}});
      $(document).ready(function () {

         $("[name='Login']").on("click",function () {
            var account=$("[name='username']").val();
            var password=$("[name='password']").val();
            var CheckBox = document.getElementById("failure").className;
            if  (account=="" || password=="") {
               $.message({
                  message : '账号/密码不能为空！',
                  type : 'error',
                  time : '2000'
               });
            }else {
               if (CheckBox!="CheckBox Yes"){
                  $.message({
                     message : '请阅读并同意用户协议！',
                     type : 'error',
                     time : '2000'
                  });
               }else {
                  $.get("checkUser","account="+account+"&password="+password,function (boo) {
                     if (boo){
                        $.message({
                           message : '账户/密码错误，登录失败！',
                           type : 'error',
                           time : '2000'
                        });
                     }else {
                        $.message({
                           message : '登录成功！',
                           time : '2000'
                        });
                        setTimeout(function(){
                           //doSomething(这里写时间到之后需要去做的事情)
                           window.location = "index.jsp";
                        }, 1500);
                     }
                  });
               }
            }
         });

   });


</script>
<title>登录</title>
</head>

<body>
<div class="header">
   <div class="mainwarp">
      <div class="logo"><a href="index.jsp"><img src="images/log.png" /></a></div>
      <div class="welcome">欢迎登录</div>
      <div class="headerright">
         <a href="index.jsp">返回首页</a>
      </div>
   </div>
</div>
<div class="content">
   <div class="logtype"></div>
   <div class="clear"></div>
   <div class="logoDiv">
      <div class="logoLeft">
         <div class="leftimg">
            <img src="images/log1.gif" />
         </div>
         <div class="leftcon">
            <a href="" class="a1">手机触屏版</a>
            <a href="" class="a2">Android客户端下载</a>
            <a href="" class="a3">iPhone客户端下载</a>
         </div>
      </div>
      <div class="logoRight">
         <div class="normalLogin">
            <div class="username">
               <span></span>
               <input name="username" type="text" placeholder="请输入用户名/邮箱/已验证手机号"/>
            </div>
            <div class="password">
               <span></span>
               <input name="password" type="password" placeholder="请输入密码"/>
            </div>
            <div class="autoLogo">
               <a href="password.jsp?" class="pasd">忘记密码？</a>
            </div>
            <div class="autoLogo">
               <span class="CheckBox Yes" id="failure"></span>
               <span>我已阅读并接受<a href="user_agreement.jsp">用户协议</a></span>
            </div>
            <div class="logobtn">
            <a name="Login" href="#">登  录</a>
         </div>
            <span id="span1"></span>
            <div class="zcbtn">
               <a href="register.jsp">还没有账号？立即注册</a>
            </div>
         </div>
         <div class="weixinLogin">
            <div class="weixinQr">
               <img src="images/showqrcode.jpg" width="150" class="useHelpcon"/>
               <p>使用微信扫描上方二维码</p>
               <p class="useHelp useHelpcon">使用帮助</p>
            </div>
            <div class="zcbtn">
               <a href="register.jsp">还没有账号？立即注册</a>
            </div>
         </div>
      </div>
   </div>
</div>

<div class="clear"></div>
</body>

